package com.urms.controller;

import com.urms.pojo.Result;
import com.urms.pojo.User;
import com.urms.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {

    @Autowired
    private UserService userService;


    // 注册接口
    @PostMapping("/user/register")
    public Result register(@RequestBody User user, String type) {
        return userService.register(user,type);
    }

    // 登录接口
    @GetMapping("/user/login")
    public Result login(String phone, String password, String type) {
        return userService.login(phone,password,type);
    }

    // 获取用户信息接口
    @GetMapping("/user/getUserInfo")
    public Result getUserInfo(String token,String type) {
        return userService.getUserInfo(token,type);
    }

}
